package pers.xuyong.strive.datastruct.mode.single;

/**
 * 线程安全同步
 *
 * @author billymac
 * @version 1.0
 * @date 17/6/26  下午9:52
 * @since JDK1.8
 */
public class Singleton {

    private Singleton() {}

    public static Singleton getInstance() {
        return SingletonIn.singleton;
    }

    public void display() {
        System.out.println(Singleton.class.getName() + " is Singleton for  static inner class!");
    }

    private static class SingletonIn {
        private final static Singleton singleton = new Singleton();
    }
}
